#include "FormatFilter.h"

FormatFilter::FormatFilter(const std::map<std::string, std::string>& formats) :
                           formats_(formats) { }

AlgResultType FormatFilter::operator () (const FilePairType& file_pair) const {

    auto first = file_pair.first->format;
    auto second = file_pair.second->format;
    if (formats_.find(first) == formats_.end() ||
        formats_.find(second) == formats_.end()) {
        return AlgResultType(UNKNOWN); 
    }
    return formats_.at(first) != formats_.at(second) ?
           AlgResultType(UNCOMPARABLE) : 
           AlgResultType(UNKNOWN);
}
